package cn.tedu.inner;

import java.io.*;
import java.lang.reflect.Method;
import java.nio.file.Path;
import java.util.Scanner;

public class IOUtils {
    public static void main(String[] args) throws Exception {
       // method();//按行读
      // method2();//按行写
        method3();
    }

    public static void method3() throws IOException {
        BufferedReader in=new BufferedReader(new FileReader("d:\\iotest\\14.txt"));
        PrintWriter writer=new PrintWriter(new FileWriter("d:\\iotest\\14.txt",true) );

        String line="";
        while ((line= in.readLine())!=null){
            writer.println(line);
        }

        in.close();
        writer.close();
    }

    public static void writeLine(String path,String a) throws IOException {
        PrintWriter writer=new PrintWriter(new FileWriter(path,true) );
        writer.println(a);
        writer.close();//作用：flush（）+close（）
    }
    public static void readLine(String path) throws IOException {
        BufferedReader in=new BufferedReader(new FileReader(path));
        String line="";
        while ((line= in.readLine())!=null){
            System.out.println(line);
        }
    }

}
